#!/usr/bin/python3
# -*- coding:utf-8 -*-
# __author__ == taoyulong2018@gmail.com
# __time__ == 2023/8/17 14:51
# ===========================================
#       题目名称： 9. 回文数
#       题目地址： https://leetcode.cn/problems/palindrome-number/
#       题目描述： https://note.youdao.com/s/RRXNSXjR
# ===========================================

import math


class Solution:
    """
        實現思路：
            转为列表反转
    """
    def isPalindrome(self, x: int) -> bool:
        MAX_VALUE = math.pow(2, 31) - 1
        MIN_VALUE = math.pow(-2, 31)
        if not MIN_VALUE <= x <= MAX_VALUE:
            return False
        old_x = list(str(x))
        new_x = old_x.copy()
        new_x.reverse()
        return old_x == new_x


if __name__ == '__main__':
    s = Solution()
    print("True =>", s.isPalindrome(x=121))
    print("False =>", s.isPalindrome(x=-121))
    print("False =>", s.isPalindrome(x=10))
